home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wonky Flux Batch 2019 02
/
Wonky_Flux_Batch_2019-02.zip
/
Wonky Flux Batch 2019-02
/
072 - EXFER 4.1 4.2.dsk
/
EXFER.AUX.S
< prev
next >
Wrap
Text File
|
2019-02-17
|
22KB
|
625 lines
; *****************************
;
; EXfer:
; The Extended Transfer Module
;
; This program is for use on
; the ProDOS version of GBBS
; "Pro" 1.3
;
; Created and Copyrighted
; 1986 and 1987
; by Mike Golaszewski
;
; Copyright 1988 by G-Tech
; All Rights Reserved
;
; *****************************
; auxilliary function segment, version 4.2
; created 6/20/88 - modified 7/30/88
; define linkable lables
public aux.aux
on nocar goto terminate
push return
if i$="C" goto copy
if i$="H" goto help
if i$="K" goto kill
if i$="M" goto message
if i$="V" goto view
if i$="W" goto wallet
; return to the main EXfer segment
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return
link "a:exfer.seg","prompt"
; show credits available and library info
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wallet
print 'Your wallet has 'cr' credits....
Uploads to this library pay 'um' credits per kilobyte
Downloads cost 'dm' credits per kilobyte.
Current protocol: ' ;:if pt print "Ymodem batch":return
print "Xmodem":return
; display help on a command
; ~~~~~~~~~~~~~~~~~~~~~~~~~
help
print "Help on which command? ->";:get i$:if i$="" return
x$="CDFHIKLMNRSTVX?BGQWY":x=instr(i$,x$):if x=0 return
ready "d:hlp.exfer":print \\s$\:input #msg(x),a,x$
input #6,x$:setint(1):print x$\:copy #6:setint("")
ready d2$:return
; message to librarian
; ~~~~~~~~~~~~~~~~~~~~
message
print screen$"Enter feedback: ["edit(3)"] cols, [4K] Max"
print "[DONE] when finished, [.H] for help":edit(0)
edit(1):if not(edit(2)) then return:else ready "g:mail"
d=b1:if not(d) then d=1
if info(6)<29 print \"XT: Bit-map full!":ready d2$:return
print #msg(d),un:print #6,"EXfer: Feedback from a user."\
print #6,"From ->"a1$" "a2$" [#"un"]"
print #6,"Date ->"date$" "time$\:copy #8,#6
print #msg(d),chr$(4);chr$(0);
msg(d)=1:update:ready d2$:return
; view a file
; ~~~~~~~~~~~
view
if not(b3) goto lsec
input @2 "View:" i$:if i$="" return
if (val(i$)) or (left$(i$,1)="#") gosub nread:goto view.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
view.x
if not(l) goto nfile
if not(byte(9)) print '
XT: This file must first be validated
by the sysop before it can be
accessed....':return
gosub name:f$=bf$+f$:gosub dtype
if ty$<>"TXT" print \"XT: Not a TXT type file....":return
gosub chkfil:if a close:goto nfile
print \s$\:setint(1):copy #1:close
setint(""):if not(lb) then cr=cr-((byte(10)+byte(11)*256)/2)*dm
return
; show file info
; ~~~~~~~~~~~~~~
aux.aux
on nocar goto terminate
ready d2$:push aux.aux
if f$="aux.info" gosub info
if f$="directory" gosub directory
if f$="global" gosub global
if f$="new" gosub new
if f$="search" gosub search
pop:link "a:exfer.seg","prompt"
; get filename & look for info
info
d=0:input @2 "Info on:" i$:if i$="" return:else na$=i$
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto info.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
; see if the file has information
info.x
if l<0 goto nfile:else c=byte(12)+byte(13)*256:d=byte(14)
if (not(byte(9))) and (not(lb)) goto unval
if (not(d)) and (lb or (c=un)) goto info.a
if not(d) print xt$;chr$(7)"File has no information":return
; display file information
info.1
input #msg(d),z:input #6,i$:gosub name:print \s$\
setint(1):print "Filename:";:if lb print bf$;f$:else print i$
copy #6:setint(""):if lb or (c=un) goto info.a
return
; see if info is to be added or updated
info.a
if d print xt$"Edit this information? ([Y]/N):";:else print '
XT: Would you like to enter a short
description of this upload? ([Y]/N):';
input @2 i$:i$=left$(i$,1):if i$="N" return
edit(0):if d input #msg(d),a:input #6,x$\y$\z$:copy #6,#8
gosub edesc:if not(edit(2)) return:else if d goto info.e
a=1:gosub findinfo
; replace information
info.s
open #1,d1$:position #1,32,l+1:input #1,na$:close
kill #msg(d):print #msg(d),un:print #6,na$
print #6,"Uploader: "a1$" "a2$" [#"un"]"
print #6,"Uploaded: "date$" "time$\:copy #8,#6
; update the message file & rewrite directory entry
info.b
msg(d)=255:update:open #1,d1$:position #1,32,l+1
input #1,na$:input #1,ty$:read #1,ram2+9,10:byte(14)=d
position #1,32,l+1:print #1,na$:print #1,ty$
write #1,ram2+9,10:close
return
; info already exists
info.e
input #msg(d),a:input #6,x$\y$\z$:kill #msg(d)
print #msg(d),a:print #6,x$\y$\z$\:copy #8,#6:goto info.b
; SUBROUTINE - find an empty message entry
findinfo
if msg(a) then a=a+1:else d=a:return
if a>msg(0) then d=a:return
goto findinfo
; kill a file
; ~~~~~~~~~~~
; make sure the file belongs to the user
kill
input @2 "Kill:" i$:if i$="" return
if (val(i$)) or (left$(i$,1)="#") gosub nread:l=l-1:goto kill.x
i$=left$(i$+chr$(32,14),15):gosub read
if not(l) goto nfile
kill.x
if l<0 goto nfile
if lb goto kill.1:else a=byte(12)+byte(13)*256
if a<>un print \"XT: That is not your file.":return
; kill the file
kill.1
gosub name:i$="Y"
if info(5) input @2 \"XT: Remove file from disk? ([Y]/N):" i$
f$=bf$+f$:x=byte(14):fill ram2+9,32,0:if i$<>"N" kill f$
open #1,d1$:position #1,32,l+1:print #1,chr$(13):write #1,ram2+9,30:close
if not(v) then nibble(3)=nibble(3)-(a=un):else ul=ul-(a=un)
if not(x) goto getslt
; scan for the message containing file's information
kill.2
msg(x)=0:kill #msg(x):update:goto getslt
; copy a file
; ~~~~~~~~~~~
copy
if not(b4) goto lsec:else if nb=255 goto dfull
input @2 "Copy:" i$:if i$="" return
na$=left$(i$+chr$(32,14),15):i$=na$:gosub read
gosub name:f$=bf$+f$:gosub chkfil:close
if a and not(l) goto copy.2
if lb goto copy.1:else print '
XT: 'chr$(7)"Duplicate name on ProDOS volume.":return
; see what sysop wishes to do with duplicate
copy.1
if l then nb=l
input @2 \"XT: File exists....overwrite? ([Y]/N):" i$
if i$="N" return:else kill f$
; get the text
copy.2
print screen$'
For files exceeding 4096 bytes, use the
R)eceive command....
Enter text: 'edit(3)' columns, [4K] max
[DONE] when finished, [.H] for help'
edit(0):edit(1):if not(edit(2)) return
input @2 \"XT: Is this a Ymodem list macro? ([Y]/N):" i$
; get some info on the file
create f$:open #1,f$:copy #8,#1:close
nibble(3)=nibble(3)+1:gosub size:gosub sfile
byte(14)=0:byte(15)=0:ty$="TXT":if i$<>"N" then ty$="LST"
push getslt:if nb<>byte(4) goto write:else goto update
; catalog a library
; ~~~~~~~~~~~~~~~~~
; print directory headers
directory
print screen$:gosub dir.h
if not(b3) print "XT:"chr$(7)" Directory disallowed....":goto getslt
use "d:xtyp",bf$
; grab an entry
open #1,d1$:for l=1 to byte(4):f$=""
position #1,32,l+1:input #1,f$:input #1,ty$
position #1,32,l+1,20:read #1,ram2+9,10:if f$="" goto dir.1
setint(1)
; if its valid, print it
gosub dir.e:print:if byte(9) goto dir.1
if (not(byte(9))) and (not(lb)) goto dir.1
; update if not validated
print \chr$(7,3)"XT: Validate above file? (Y/N/K):";:get i$
print chr$(8,35);chr$(32,35);chr$(8,35)
if i$="Y" position #1,32,l+1,20:print #1,chr$(255);
if i$<>"K" goto dir.1:else position #1,32,l+1:fill ram2+9,31,0
print #1,chr$(13):write #1,ram2+9,30:i$=f$:gosub name
kill f$:if l<nb then nb=l
dir.1
if key(1) then l=byte(4)
next:close:setint("")
x=peek(865)+peek(866)*256:y=peek(867)+peek(868)*256
z=x-y:print \chr$(14)"Kbytes Free:"left$(str$(z)+chr$(32,4),5);
print " " ;right$(" Kbytes Used:"+str$(y),17);
if edit(3)>39 print chr$(32,10)"Total Kbytes:"x:else print
return
; :::::::::::::::::::::::::::::::
; "directory display" subroutines
; :::::::::::::::::::::::::::::::
; show a directory header
; ~~~~~~~~~~~~~~~~~~~~~~~
dir.h
print right$("00"+str$(bb),3)": "bn$;
if edit(3)>39 print chr$(32,23)"Librarian:";
print " "right$("00"+str$(b1),3)\\" # Filename Type ";
if edit(3)<79 print "Size Dated Cost"\:return
print "I Size Uploaded Uploader Downloaded Credits Misc"\
return
; show a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~
dir.e
print right$("00"+str$(l+1),3)" "f$" "ty$" ";:if edit(3)<79 goto dir.x
if byte(14) print "Y ";:else print "N ";
dir.x
x=byte(10)+byte(11)*256:print right$(" "+str$(x),4)" ";
b$=when$:a$=right$(b$,3)+left$(b$,5):y=byte(18):x=byte(12)+byte(13)*256
if edit(3)<79 goto dir.40
if not(byte(9)) poke 50,255:print chr$(15)"VALIDATE!"chr$(14);:poke 50,0
if (byte(9)) and (lc$>a$) print b$;:goto dir.c
if not(byte(9)) goto dir.c
poke 50,255:print chr$(15)"NEW FILE"chr$(14);:poke 50,0
dir.c
print " User "right$("00"+str$(x),3)" "right$(" "+str$(y),3)" times ";
x=((byte(10)+byte(11)*256)/2)*dm:print right$(" "+str$(x),7)" ";
if lc$<=a$ print "NEW";
return
dir.40
if not(byte(9)) print " VAL ";
if (lc$>a$) and (byte(9)) print left$(b$,5);:else if byte(9) print " NEW ";
x=((byte(10)+byte(11)*256)/2)*dm:if cr>=x print "$";:else print " ";
print right$(" "+str$(x),4);:return
; new file search
; ~~~~~~~~~~~~~~~
new
print screen$"XT: ";
if i$="N" print "Display new files....":else print "Scan files by date...."
if i$="N" then c=1:goto new.1
print xt$"Default date is "mid$(lc$,4,5);left$(lc$,3)
print xt$"Enter new date or press [RETURN] to"
input @2 " accept default:" i$:if i$="" then i$=lc$:goto new.1
if (mid$(i$,3,1)<>"/") or (mid$(i$,6,1)<>"/") print '
XT: Please use the form: MM/DD/YY....';:get i$:print:i$="Q":goto new
c=3:i$=right$(i$,3)+left$(i$,5)
new.1
print:gosub scanvol:gosub security:x=b:print \s$:goto scanit
; search for a file
; ~~~~~~~~~~~~~~~~~
search
b=0:input @2 "Find:" i$:if i$="" return
print:gosub scanvol:print screen$"XT: Searching for...."\" :>"i$\\s$
gosub security:c=2:x=b:goto scanit
; global file list
; ~~~~~~~~~~~~~~~~
global
print screen$'XT: Global directory of all accessable
downloads....'\:gosub scanvol
c=4:gosub security:x=b:print \s$:goto scanit
; :::::::::::::::::::::::::::::::::::::::::::
; subroutines for various "file scan" options
; :::::::::::::::::::::::::::::::::::::::::::
; get a starting library number
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scanvol
input @2 "XT: Starting at library? [1] #" x$:if x$="" then b=1
if not(b) then b=val(x$):if (b<1) or (b>255) print '
XT: 'chr$(7)"That library doesn't exist!":pop:return
f$="d:xv."+str$(b):gosub chkfil:close:if not(a) return
print xt$ ;chr$(7)"Starting library doesn't exist!":pop:return
; search for and display a particular file entry
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scanit
b=1:ob=bb:for z=x to 255:setint(1):flag=ram2+32:y=flag(z):flag=ram+22
if key(1) then z=255:next:goto scanit.3
if y goto scanit.1:else next:goto scanit.3
; log to the library and show we are examining it
scanit.1
bb=z:gosub log:if b print xt$"Scanning library #"right$("00"+str$(bb),3);
if not(b) print chr$(8,3);right$("00"+str$(bb),3);
if bf$="" then l=z:gosub biterr:next:goto scanit.3
if not(b2) next:goto scanit.3
b=0:open #1,d1$:for l=1 to byte(4):position #1,l+1,32
input #1,f$:if f$="" goto scanit.2
input #1,ty$:read #1,ram2+9,10:b$=when$
a$=right$(b$,3)+left$(b$,5):setint(1)
; do necessary checks for whatever scan function we are using
if (c=1) and (lc$<=a$ or not(byte(9))) goto scanit.d
if (c=2) and (instr(i$,f$)) goto scanit.d
if (c=3) and (i$<=a$) goto scanit.d
if (c=4) goto scanit.d
goto scanit.2
; display the file entry on the screen
scanit.d
b=b+1:if b=1 print chr$(8,25);:gosub dir.h
gosub dir.e:print
; we are finished, or interrupted
scanit.2
if key(1) then l=byte(4):z=255
next:close:setint(""):next
scanit.3
print:bb=ob:goto log
; user has dropped carrier
; ~~~~~~~~~~~~~~~~~~~~~~~~
terminate
link "a:exfer.seg","terminate"
; ::::::::::::::::::::
; disk I/O subroutines
; ::::::::::::::::::::
; get an empty slot
; ~~~~~~~~~~~~~~~~~
getslt
nb=0:open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,i$
if (i$="") and (nb=0) then nb=l:l=byte(4)
next:close:if not(nb) then nb=byte(4)
return
; update "number of entries" counter
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
update
byte(4)=byte(4)+1:open #1,d1$:print #1,bn$
print #1,bf$:write #1,ram2,9:close
; write a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~~
write
open #1,d1$:position #1,32,nb+1:print #1,na$
print #1,ty$:write #1,ram2+9,10:close
z=nb:return
; read a directory entry
; ~~~~~~~~~~~~~~~~~~~~~~
read
open #1,d1$:for l=1 to byte(4)
position #1,32,l+1:input #1,f$
if instr(i$,f$)=1 then p=l:l=byte(4):next:l=p:goto read.1
next:close #1:l=0:return
read.1
input #1,ty$:read #1,ram2+9,10:close #1
return
; read a file by slot #
; ~~~~~~~~~~~~~~~~~~~~~
nread
if left$(i$,1)="#" then i$=mid$(i$,2)
l=val(i$):if (l<2) or (l>253) then l=0:return
open #1,d1$:position #1,32,l
input #1,f$:if f$="" close #1:l=0:return
input #1,ty$:read #1,ram2+9,10:close #1
i$=f$:if pt=2 return:else print \"XT: [#"l"]: "i$:return
; find the type of a file
; ~~~~~~~~~~~~~~~~~~~~~~~
dtype
use "d:xtyp",f$:x=peek(ram2+32)
x$="???0TXT4PDA5BIN6ADB25AWP26ASP27SRC176OBJ177LIB178S16179RTL180EXE181"
x$=x$+"STR182RIF183NDA184CDA185SET186PNT192PIC193ANI194FNT200PAS239CMD240"
x$=x$+"COM245P16249BAS252VAR253REL254SYS255"
ty$="":y=instr(str$(x),x$):if y then ty$=mid$(x$,y-3,3):return
ty$="$"+chr$(48+x/16+((x/16)>9)*7)+chr$(48+x mod 16+((x mod 16)>9)*7)
return
; return the size of F$ in A
; ~~~~~~~~~~~~~~~~~~~~~~~~~~
size
open #1,f$:a=size(1)/2+1:close:return
; see if file exists
; ~~~~~~~~~~~~~~~~~~
chkfil
open #1,f$:a=mark(1):return
; :::::::::::::::::::
; special subroutines
; :::::::::::::::::::
; convert to a valid ProDOS name
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; shorten I$ to directory length
name
if len(i$)>15 then i$=left$(i$,15)
i$=i$+chr$(1)
; make sure the first char is a letter
name.0
a=asc(left$(i$,1)):if a=1 pop:return
if (a>64) and (a<91) then i$=left$(i$,len(i$)-1):goto name.1
if (a>96) and (a<123) then i$=left$(i$,len(i$)-1):goto name.1
i$=mid$(i$,2):goto name.0
; remove symbols from the name
name.1
f$="":for x=1 to len(i$):a=asc(mid$(i$,x,1))
if (a>64) and (a<91) goto name.2
if (a>96) and (a<123) goto name.2
if (a>47) and (a<58) goto name.2
if a=46 goto name.2:else goto name.3
; add a valid character
name.2
f$=f$+chr$(a)
; if we dont have a name, return to the prompt
name.3
next:if f$="" pop:return
if len(f$)>15 then f$=left$(f$,15)
return
; set file information
; ~~~~~~~~~~~~~~~~~~~~
sfile
byte(9)=byte(3):byte(10)=a mod 256:byte(11)=a/256
byte(12)=un mod 256:byte(13)=un/256:byte(18)=0
when$="x":if lb then byte(9)=255
return
; get a file description
; ~~~~~~~~~~~~~~~~~~~~~~
edesc
print '
Enter description: 'edit(3)' cols, [4K] max
[DONE] when finished, [.H] for help'
edit(1):return
; :::::::::::::
; directory I/O
; :::::::::::::
; log to a library and get some dir info
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
log
byte=ram2:fill ram2,32,0:bf$="":z$="d:xv."+str$(bb)
open #1,z$:input #1,bn$:input #1,bf$
read #1,ram2,9:close:b1=byte(5)+byte(6)*256
b2=1:if byte(0) then b2=flag(byte(0))
b3=1:if byte(1) then b3=flag(byte(1))
b4=1:if byte(2) then b4=flag(byte(2))
um=byte(7):dm=byte(8):lb=(un=b1)
if info(5) then lb=1:b2=1:b3=1:b4=1
d1$="d:xv."+str$(bb):d2$="d:dv."+str$(bb)
if bf$ ready d2$:bf$=left$(bf$,instr(":",bf$))
return
; update errant bit-map
; ~~~~~~~~~~~~~~~~~~~~~
biterr
open #1,"d:xt.bitmap":read #1,ed+1,255:close
poke ed+l,255:open #1,"d:xt.bitmap"
write #1,ed+1,255:close:open #1,"d:xt.volumes"
position #1,32,l:print #1,chr$(13):close
return
; move security flags from EDIT(5) to RAM2+32
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
security
open #1,"d:xt.bitmap":read #1,ed+1,255:close:fill ram2+32,32,0
for l=1 to 255:if peek(ed+l)>34 next:return
x=peek(ed+l):if (flag(x)) or (x=0) then flag=ram2+32:flag(l)=1:flag=ram+22
next:return
; ::::::::::::::
; error messages
; ::::::::::::::
lsec
print \"XT:"chr$(7)" Security too low....":return
dfull
print \"XT:"chr$(7)" Directory full....":return
nfile
print \"XT:"chr$(7)" No such file....":return
unval
print xt$ ;chr$(7)'File must be validated before it
can be accessed....':return